#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QChart>
#include "QChartView"
#include <QSplineSeries>
#include <QValueAxis>
#include "qserialport.h"
#include "qserialportinfo.h"


QT_CHARTS_USE_NAMESPACE
QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
    void Serial_Init();
    void ChartInit();

private slots:
    void Read_Data();
    void on_Button_operate_clicked();

    void on_Button_Send_clicked();

    void on_Button_Collect_clicked();

    void on_Button_clear_clicked();

private:
    Ui::Widget *ui;
    QSerialPort *serial;
    QChart* mChart;
    QLineSeries * mline1;
    QValueAxis *axisX;                          //建立坐标轴
    QValueAxis *axisY;
    double Xvalue;                              //设置X轴变量
    double Yvalue;                              //设置Y轴变量
};
#endif // WIDGET_H
